package net.tv90.bfmccore.command;

import net.tv90.bfmccore.helper.MCHHelper;
import org.bitterorange.flansmodslain.FlansModAPI;
import org.bukkit.Bukkit;
import org.bukkit.command.Command;
import org.bukkit.command.CommandExecutor;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Entity;
import org.bukkit.entity.Player;

import static net.tv90.bfmccore.helper.MCHHelper.*;

public class MCHCommand implements CommandExecutor {
    @Override
    public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
        if (label.equalsIgnoreCase("mch")) {
            if (args.length == 0) {
            }
            if (args[0].equalsIgnoreCase("nearby")) {
                Player player = (Player) sender;
                int radius = Integer.parseInt(args[1]);
                String s = String.valueOf(MCHHelper.getNearbyEntitiesInfo(player,radius));
                player.sendMessage(s);
            }
            if (args[0].equalsIgnoreCase("clear")) {
                MCHHelper.clearMCHEntities();
            }
            if(args[0].equalsIgnoreCase("setinf")){
                setINF(Bukkit.getPlayerExact(args[1]));
            }
            return true;
        }
        return true;
    }

}
